home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / Hash.man < prev    next >
Encoding:
Text File  |  1989-02-13  |  3.3 KB  |  135 lines

  1.  
  2.  
  3.  
  4. Hash                  C Library Procedures                   Hash
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NNAAMMEE
  11.      Hash - overview of routines to manipulate hash tables
  12.  
  13. _________________________________________________________________
  14.  
  15.  
  16.      The Hash_ routines provide mechanisms for manipulating  hash
  17.      tables.   A  hash  table is a data structure that stores any
  18.      number of entries, each of which is  a  <key,  value>  pair.
  19.      Given the key for a particular entry, the Hash_ routines can
  20.      very quickly  find  the  entry  (and  hence  the  associated
  21.      value).   There can be at most one entry with a given key in
  22.      a hash table at a time, but many entries may have  the  same
  23.      value.
  24.  
  25.      This library provides two  unusual  features.   First,  hash
  26.      tables  can grow gracefully.  In most hash table implementa-
  27.      tions the  number of buckets in the table is fixed;  if  the
  28.      number  of entries in the table becomes substantially larger
  29.      than the number of buckets, the  performance  of  the  table
  30.      degrades.   In  contrast,  this implementation automatically
  31.      re-allocates the bucket memory as the  table  grows.   As  a
  32.      result,  hash  tables  can  become arbitrarily large without
  33.      overloading the buckets.  An initial number of  buckets  may
  34.      be  provided when tables are initialized, but it will change
  35.      later (automatically) if necessary  to  guarantee  efficient
  36.      operation.
  37.  
  38.      The second unusual feature of the  Hash_  routines  is  that
  39.      they  allow keys to be expressed in several forms.  Keys may
  40.      either  be  variable-length  NULL-terminated   strings,   or
  41.      single-word  values, or multi-word records of any length (in
  42.      the latter case, all keys in the  table  must  be  the  same
  43.      length).   See  Hash_InitTable  for deatils on the different
  44.      key types.
  45.  
  46.      Hash tables are initialized by calling HHaasshh__IInniittTTaabbllee.   New
  47.      entries   are  added  with  HHaasshh__CCrreeaatteeEEnnttrryy,  and  existing
  48.      entries may  be  located  with  either  HHaasshh__CCrreeaatteeEEnnttrryy  or
  49.      HHaasshh__FFiinnddEEnnttrryy.   The  values  stored in entries are manipu-
  50.      lated with HHaasshh__GGeettVVaalluuee and Hash_SetValue  (values  may  be
  51.      arbitrary  one-word  values;  they are stored in entries and
  52.      retrieved from them  using  the  type  ``ClientData'').   An
  53.      entry   can   be   deleted   from   the   table  by  calling
  54.      HHaasshh__DDeelleetteeEEnnttrryy;  the entire table can be released by  cal-
  55.      ling  HHaasshh__DDeelleetteeTTaabbllee.   HHaasshh__EEnnuummFFiirrsstt  and  HHaasshh__EEnnuummNNeexxtt
  56.      provide a facility for stepping through all the entries in a
  57.      table.  Finally, HHaasshh__PPrriinnttSSttaattss can be invoked to print out
  58.      some usage information about a hash table.
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. Sprite v.1.0       Printed:  February 13, 1989                  1
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. Hash                  C Library Procedures                   Hash
  73.  
  74.  
  75.  
  76. KKEEYYWWOORRDDSS
  77.      hash table, key, value
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131. Sprite v.1.0       Printed:  February 13, 1989                  2
  132.  
  133.  
  134.  
  135.